package test916;

import java.util.Scanner;

public class myCalculator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("请输入第一个数：");
        double num1 = scanner.nextDouble();

        System.out.print("请输入运算符（+、-、*、/）：");
        String operator = scanner.next();

        System.out.print("请输入第二个数：");
        double num2 = scanner.nextDouble();

        double result = 0;

        switch (operator) {
            case "+":
                result = num1 + num2;
                break;
            case "-":
                result = num1 - num2;
                break;
            case "*":
                result = num1 * num2;
                break;
            case "/":
                result = num1 / num2;
                break;
            default:
                System.out.println("无效的运算符");
                break;
        }

        System.out.println("结果：" + result);
    }
}
